<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: class.gallery.php 398 2014-01-18 16:01:01Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 398 $
* 	zuletzt geaendert von:	$Author: $
* 	Datum:					$Date: 2014-01-18 16:01:01 +0000 (Sat, 18 Jan 2014) $
*
* 	extends by dirk.mueller (edv-mueller.com)
* 	http://www.itdotmedia.de
*
* --------------------------------------------------------------------------------------
* 	based on:
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
* 	Copyright (c) since 2011 SEO:mercari
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */
include_once (DIR_WS_INCLUDES.'modules/product_konfigurator/class.base.php');

class gallery extends base {

  function assign_template(&$smarty, $product_id, $with_form_action) {
    global $db, $product;

		parent::assign_template($smarty, $product_id, $with_form_action);
		
		$option_smarty = $this->get_option_smarty($product_id);
		if ($option_smarty == false) return;
		$template_name = $option_smarty->getTemplateVars('TEMPLATE');

    $option_smarty->assign('FORM_ACTION', $with_form_action);
    $option_smarty->assign('IMAGE_MAIN', DIR_WS_INFO_IMAGES.$product->data['products_image']);
    $option_smarty->assign('TEMPLATE_FILE', $smarty->getTemplateVars('TEMPLATE_FILE'));

		// popup Layer hinzufuegen		
    $layer_file_name = DIR_FS_DOCUMENT_ROOT. 'templates/'.CURRENT_TEMPLATE.'/module/product_konfigurator/gallery.'.strtolower($this->group['id']).'.html';
    if (file_exists($layer_file_name))
      $layer_file_name = CURRENT_TEMPLATE.'/module/product_konfigurator/gallery.'.strtolower($this->group['id']).'.html';
    else
      $layer_file_name = CURRENT_TEMPLATE.'/module/product_konfigurator/gallery.base.html';

  	if (!CacheCheck()) {
      $option_smarty->caching = false;
      $option_popup = $option_smarty->fetch($layer_file_name);
    }
    else {
      $option_smarty->caching = true;
      $option_smarty->cache_lifetime = CACHE_LIFETIME;
      $option_smarty->cache_modified_check = CACHE_CHECK;
      $cache_id_popup = $product->data['products_id'].$this->group['id'].'popup'.$_SESSION['language'].$_SESSION['customers_status']['customers_status_name'];
  		$option_popup = $option_smarty->fetch($layer_file_name, $cache_id_box);
    }

    $LAYER_KONFIGURATOR = $smarty->getTemplateVars('LAYER_KONFIGURATOR');
    if ($LAYER_KONFIGURATOR != '') $LAYER_KONFIGURATOR .= "\n";
    $smarty->assign('LAYER_KONFIGURATOR', $LAYER_KONFIGURATOR . $option_popup);
  }
  
}